﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.MediaCenter.Hosting;
using Microsoft.MediaCenter.UI;
using System.Linq;
using System.Xml.Linq;
using Playkanaler;

namespace Playkanaler
{





    public class PopItem
    {
        string typename;
        public string TypeName
        {
            get
            {
                return typename;
            }
            set
            {
                typename = value;
            }
        }
    }
    public class PopCommand : PopItem
    {
        string title;
        public string Title
        {
            get
            {
                return title;
            }
            set
            {
                title = value;
            }
        }
        Image image;
        public Image Image
        {
            get
            {
                return image;
            }
            set
            {
                image = value;
            }
        }
        Image himage;
        public Image ImageHover
        {
            get
            {
                return himage;
            }
            set
            {
                himage = value;
            }
        }
        public delegate void func();

        public PopCommand()
        {

        }
        public func Function;
        virtual public void Invoke()
        {
            Function();
        }


    }
    public class Popup : ModelItem
    {
        List<PopupPage> pages = new List<PopupPage>();
        int selectedPageIndex;
        string line2;
        string line3;
        public Popup()
        {
            Line2 = "line2";
            Line3 = "line3";
            //Image = new Image("");
            PopupPage pp = new PopupPage();
            pp.Title = "Test";
            pp.Index = 0;
            Pages.Add(pp);

            pp = new PopupPage();
            pp.Title = "Test2";
            pp.Index = 1;
            Pages.Add(pp);
        }
        public string Line2
        {
            get
            {
                return line2;
            }
            set
            {
                line2 = value;
            }
        }
        public string Line3
        {
            get
            {
                return line3;
            }
            set
            {
                line3 = value;
            }
        }

        Image image;
        public Image Image
        {
            get
            {
                return image;
            }
            set
            {
                image = value;
            }
        }

        public int SelectedPageIndex
        {
            get
            {
                return selectedPageIndex;
            }
            set
            {
                selectedPageIndex = value;
                FirePropertyChanged("SelectedPageIndex");
                FirePropertyChanged("SelectedPage");
            }
        }
        public int LeftIndex
        {
            get
            {
                if (SelectedPageIndex == 0) return Pages.Count - 1;
                else return SelectedPageIndex - 1;
            }
        }
        public int RightIndex
        {
            get
            {
                if (SelectedPageIndex == Pages.Count - 1) return 0;
                else return SelectedPageIndex + 1;
            }
        }

        public PopupPage SelectedPage
        {
            get
            {
                return pages[selectedPageIndex];
            }
        }

        public List<PopupPage> Pages
        {
            get
            {
                return pages;
            }
            set
            {
                pages = value;
            }
        }

    }
    public class PopupPage
    {
        int index;
        string title;
        public int Index
        {
            get
            {
                return index;
            }
            set
            {
                index = value;
            }
        }

        public string Title
        {
            get
            {
                return title;
            }
            set
            {
                title = value;
            }
        }

        List<PopItem> items = new List<PopItem>();


        public List<PopItem> Items
        {
            get
            {
                return items;
            }
            set
            {
                items = value;
            }
        }

    }
}
